﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BAL.EstRec.CAT
{
    public class DatosHQ
    {
        public static DataTable GetDataHQ(string unidVersion)
        {
            try
            {
                DataTable dt = DAL.EstRec.SrvDB.ExecuteQuery("EXEC SP_ER_v050_GET_HQBGT'" + unidVersion + "'");
                if (dt.Rows.Count == 0)
                {
                    return null;
                }
                else
                {
                    return dt;
                }

            }
            catch (Exception)
            {
                
                throw;
            }
               
        }
        public static string GetInsertHQ(string unidVersion,string unidHQ,string idPos, int idRecurso,int cantidad, int conformed)
        {
            try
            {
                string mesaje="";
                DataTable dt = DAL.EstRec.SrvDB.ExecuteQuery("EXEC SP_INSERT_HQBGT'" + unidVersion + "','" + unidHQ + "','" + idPos + "'," + idRecurso +"," + cantidad +","+conformed);
                if (dt.Rows.Count == 0)
                {
                    return mesaje="Exito al guardar";
                }
                else
                {
                    return mesaje="Error al guardar";
                }

            }
            catch (Exception)
            {

                throw;
            }

        }
        public static string DeleteDatosHq(string ids)
        {

            int dt = DAL.EstRec.SrvDB.ExecuteNonQuery("EXEC SP_ER_v050_DELETE_DATOS_HQ'" + ids + "'");
            return dt.ToString();
        }
    }
}
